package cn.edu.ustc.xrovers.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table
public class Company {

	private Integer id;
	private String companyId;
	private String password;
	private String name;
	private String tel;
	private String address;
	private Set<Company> companys=new HashSet<Company>();
	private Company guaCompany;
	private CompanyRole role;
	private Set<BalanceSheet> balanceSheets=new HashSet<BalanceSheet>();
	private Set<CashFlowStatement> cashFlowStatements=new HashSet<CashFlowStatement>();
	private Set<IncomeStatement> incomeStatements=new HashSet<IncomeStatement>();
	private Set<NonFinancialInformation> nonFinancialInformations=new HashSet<NonFinancialInformation>();
	private Set<Loan> loans=new HashSet<Loan>();
	private Set<ProcessedStatement> processedStatements=new HashSet<ProcessedStatement>();
	
	
	@Column(name="Com_Address")
	public String getAddress() {
		return address;
	}
	@OneToMany(mappedBy="company",cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	public Set<BalanceSheet> getBalanceSheets() {
		return balanceSheets;
	}
	@OneToMany(mappedBy="company",cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	public Set<CashFlowStatement> getCashFlowStatements() {
		return cashFlowStatements;
	}
	@ManyToOne
	@JoinColumn(name="GuaCom_Id")
	public Company getGuaCompany() {
		return guaCompany;
	}
	@Column(name="Com_Id")
	public String getCompanyId() {
		return companyId;
	}
	@ManyToOne
	@JoinColumn(name="CR_Id")
	public CompanyRole getRole() {
		return role;
	}
	@OneToMany(mappedBy="guaCompany",fetch=FetchType.LAZY)
	public Set<Company> getCompanys() {
		return companys;
	}
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Integer getId() {
		return id;
	}
	@OneToMany(mappedBy="company",cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	public Set<IncomeStatement> getIncomeStatements() {
		return incomeStatements;
	}
	@OneToMany(mappedBy="company",cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	public Set<Loan> getLoans() {
		return loans;
	}
	@Column(name="Com_Name")
	public String getName() {
		return name;
	}
	@OneToMany(mappedBy="company",cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	public Set<NonFinancialInformation> getNonFinancialInformations() {
		return nonFinancialInformations;
	}
	@Column(name="Com_Password")
	public String getPassword() {
		return password;
	}
	@OneToMany(mappedBy="company",cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	public Set<ProcessedStatement> getProcessedStatements() {
		return processedStatements;
	}
	@Column(name="Com_Tel")
	public String getTel() {
		return tel;
	}
	
	
	/*set方法*/
	public void setAddress(String address) {
		this.address = address;
	}
	public void setBalanceSheets(Set<BalanceSheet> balanceSheets) {
		this.balanceSheets = balanceSheets;
	}
	public void setCashFlowStatements(Set<CashFlowStatement> cashFlowStatements) {
		this.cashFlowStatements = cashFlowStatements;
	}
	public void setGuaCompany(Company guaCompany) {
		this.guaCompany = guaCompany;
	}
	public void setCompanyId(String companyid) {
		this.companyId = companyid;
	}
	public void setRole(CompanyRole role) {
		this.role = role;
	}
	public void setCompanys(Set<Company> companys) {
		this.companys = companys;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public void setIncomeStatements(Set<IncomeStatement> incomeStatements) {
		this.incomeStatements = incomeStatements;
	}
	public void setLoans(Set<Loan> loans) {
		this.loans = loans;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setNonFinancialInformations(
			Set<NonFinancialInformation> nonFinancialInformations) {
		this.nonFinancialInformations = nonFinancialInformations;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public void setProcessedStatements(Set<ProcessedStatement> processedStatements) {
		this.processedStatements = processedStatements;
	}
	public void setTel(String tel) {
		this.tel = tel;
	}
}
